import pygtk
pygtk.require('2.0')
import gtk
import Board
import Shape

class Screen(gtk.Window):
	
	def __init__(self):
		gtk.Window.__init__(self)
		self.connect("delete_event", gtk.main_quit)	# what to do when closed
		self.set_title("Pellegrino's first bimestre screen")
		
		background = gtk.VBox() #contentPane
		self.add(background)
		
		self.box_options = gtk.HBox() # we'll place the optiions to paint here
		self.canvas_box = Board.Board()  # temporary - where we'll paint pixels
		
		background.pack_start(self.box_options, True, True, 0)
		separator = gtk.HSeparator()
		background.pack_start(separator, True, True, 0)
		background.pack_start(self.canvas_box, True, True, 0)
		
		self.__put_options(self.box_options)		
	
	
	def __put_options(self, box):
		"""Put the option on top of the screen"""
		self.__put_clear_all(box)
		self.__put_vSeparator(box)
		self.__put_shapes(box)
		self.__put_vSeparator(box)
		self.__put_trace(box)
		self.__put_vSeparator(box)
		self.__put_colors(box)
		self.__put_vSeparator(box)
		self.__put_grouping(box)

		
	def __put_clear_all(self, box):
		""" Putting clear all """
		boxV = gtk.VBox()
		box.pack_start(boxV, True, True, 0)
		self.clear_button = gtk.Button("Clear All")
		self.clear_button.connect("clicked", self.__clicked_clearall)
		boxV.pack_start(self.clear_button, True, True, 0)


	def __put_vSeparator(self, box):
		separator = gtk.VSeparator()
		box.pack_start(separator, False, True, 0)

		
	def __put_shapes(self, box):
		""" Putting Shapes """
		boxV = gtk.VBox()
		box.pack_start(boxV, True, True, 0)
		self.radio_line = gtk.RadioButton(None, "Line")
		self.radio_circle = gtk.RadioButton(self.radio_line, "Circle")
		self.radio_polygon = gtk.RadioButton(self.radio_line, "Polygon")
		boxV.pack_start(self.radio_line, True, True, 0)
		boxV.pack_start(self.radio_circle, True, True, 0)
		boxV.pack_start(self.radio_polygon, True, True, 0)

		
	def __put_trace(self, box):		
		""" Putting Trace """
		boxV = gtk.VBox()
		box.pack_start(boxV, True, True, 0)
		self.radio_normal = gtk.RadioButton(None, "Normal")
		self.radio_dotted = gtk.RadioButton(self.radio_normal, "Dotted")
		self.radio_dashed = gtk.RadioButton(self.radio_dotted, "Dashed")
		boxV.pack_start(self.radio_normal, True, True, 0)
		boxV.pack_start(self.radio_dotted, True, True, 0)
		boxV.pack_start(self.radio_dashed, True, True, 0)

		
	def __put_colors(self, box):	
		""" Putting colors """
		boxV = gtk.VBox()
		box.pack_start(boxV, True, True, 0)
		self.check_double = gtk.CheckButton("Double")
		self.check_red = gtk.CheckButton("Red")
		self.check_green = gtk.CheckButton("Green")
		self.check_blue = gtk.CheckButton("Blue")
		boxV.pack_start(self.check_double)
		boxV.pack_start(self.check_red)
		boxV.pack_start(self.check_blue)
		boxV.pack_start(self.check_green)

		
	def __put_grouping(self, box):
		""" Putting Grouping """
		boxV = gtk.VBox()
		box.pack_start(boxV, True, True, 0)
		self.check_select = gtk.CheckButton("Select Multiple")
		
		self.button_group = gtk.Button("Group")
		self.button_group.connect("clicked", self.__clicked_group)
		
		self.button_ungroup = gtk.Button("Ungroup")
		self.button_ungroup.connect("clicked", self.__clicked_ungroup)
		
		boxV.pack_start(self.check_select)
		boxV.pack_start(self.button_group)
		boxV.pack_start(self.button_ungroup)
		
		
	def __clicked_clearall(self, clear_button):
		""" Clear all function """
		print("Clear All!!!!")
	
	
	def __clicked_group(self, group_button):
		""" Group shapes function """
		print("Group!!!")
	
	
	def __clicked_ungroup(self, ungroup_button):
		""" Ungroup shapes function """
		print("Ungroup...")
	
		
if __name__ == "__main__":
	win = Screen()
	win.show_all()
	gtk.main()
